/**
 * 作者：陈圳佳
 * 日期：2015/8/10
 */
(function (angular) {
    angular.module("login", [])
        .controller("LoginController", function ($scope, $http) {
            $scope.formValue = {};
            $scope.submit = function (e) {
                var formValue = $scope.formValue;
                var password = formValue.password;
                var url = "sign/in/" + formValue.username + "/" + password;
                $http.get(url).success(function (resp) {
                    if (resp.status) {
                        showMessage("登陆成功");
                        location.replace(resp.url);
                    } else {
                        showErrorMessage(resp.msg);
                    }
                    $(e.target).find("button[type=submit]").button('reset');
                }).error(function (resp) {
                    showErrorMessage("出错了！信息：" + resp.msg);
                });
                return false;
            };
            $scope.btnLogin = function (e) {
                $(e.target).button('loading');
            };
        })
})(window.angular);